Skip to content

Conversation

anntzer
Copy link
Contributor

@anntzer anntzer commented May 13, 2019

Excludes

sorted(obj for obj in iterator
       if some_long_cond()
          and some_other_cond())

from E127.

It is true that this also lets through some "bad" indents e.g.

(1 if a and 2 else
      b)

but at the tokenization level it is quite difficult to distinguish
between the "if" in a for b in c if d and the "if" in a if b else c,
which play quite different roles.

Closes #680.

@anntzer anntzer force-pushed the continuation-in-comprehension branch 3 times, most recently from d9582ae to f7b377a Compare March 1, 2020 18:17
Excludes
```
sorted(obj for obj in iterator
       if some_long_cond()
          and some_other_cond())
```
from E127.

It is true that this also lets through some "bad" indents e.g.
```
(1 if a and 2 else
      b)
```
but at the tokenization level it is quite difficult to distinguish
between the "if" in `a for b in c if d` and the "if" in `a if b else c`,
which play quite different roles.
@anntzer anntzer force-pushed the continuation-in-comprehension branch from f7b377a to ace7b01 Compare March 1, 2020 18:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

E127: "continuation line over-indented" when comprehension is an argument

1 participant